﻿using UnityEngine;
using System.Collections;

public class ColaFlow : MonoBehaviour {
	Material m;
	float timer=0f;
	float randomFloat;
	// Use this for initialization
	void Start () {
		m = GetComponent<SkinnedMeshRenderer> ().material;
	}
	
	// Update is called once per frame
	void Update () {
		timer -= Time.deltaTime;
		if (timer <= 0f) {
			timer = 1f;
			randomFloat = Random.Range (0f, 1f);
		}
		m.SetFloat ("_ColaRate", Mathf.Lerp (m.GetFloat ("_ColaRate"), randomFloat, 0.05f));
	}
}
